package com.jvbc.xoso;

import java.util.ArrayList;
import com.jvbc.xoso.bean.NewsPage;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.AdapterView.OnItemClickListener;

public class MainActivity extends Activity {
	

	ArrayList<NewsPage> newsArry = new ArrayList<NewsPage>();
	GridView gridView;
	//NewsPageDataSource db;
	static final String[] NEWS_PAGE = new String[] { 
		"Kết Quả", "Trực Tiếp","Thống Kê", "Soi Cầu","Dự Đoán", "Tham khảo", "Giấc Mơ", "Quay Thử", "Số Kết", "Ngũ Hành", "Tra Cứu", "Tiện Ích" };
	FlyOutContainer root;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_main);
		this.root = (FlyOutContainer) this.getLayoutInflater().inflate(R.layout.activity_main, null);
		this.setContentView(root);
		
		
		gridView = (GridView) findViewById(R.id.grid_view);
		gridView.setAdapter(new ImageAdapter(this, NEWS_PAGE));
		gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				switch (position) {
				case 0:					
					Intent inKQ = new Intent(getApplicationContext(),AndroidTabLayoutActivity.class);
					startActivity(inKQ);
					break;
				case 1:					
					Intent inTT = new Intent(getApplicationContext(),TrucTiepActivity.class);
					startActivity(inTT);
					break;
				case 2:					
					Intent inTK = new Intent(getApplicationContext(),ThongKeActivity.class);
					startActivity(inTK);
					break;
				case 3:					
					Intent inSC = new Intent(getApplicationContext(),SoiCauActivity.class);
					startActivity(inSC);
					break;
				case 4:					
					Intent inDD = new Intent(getApplicationContext(),DuDoanActivity.class);
					startActivity(inDD);
					break;
				case 5:					
					Intent inTKh = new Intent(getApplicationContext(),ThamKhaoActivity.class);
					startActivity(inTKh);
					break;
				case 6:					
					Intent inGM = new Intent(getApplicationContext(),GiacMoActivity.class);
					startActivity(inGM);
					break;
				case 7:					
					Intent inQT = new Intent(getApplicationContext(),QuayThuActivity.class);
					startActivity(inQT);
					break;
				case 8:					
					Intent inSK = new Intent(getApplicationContext(),SoKetActivity.class);
					startActivity(inSK);
					break;
				case 9:					
					Intent inNH = new Intent(getApplicationContext(),NguHanhActivity.class);
					startActivity(inNH);
					break;
				case 10:					
					Intent inTC = new Intent(getApplicationContext(),TraCuuActivity.class);
					startActivity(inTC);
					break;
				case 11:					
					Intent inTI = new Intent(getApplicationContext(),TienIchActivity.class);
					startActivity(inTI);
					break;
				}
				//NewsPage news = newsArry.get(position);
			
 
			}
		});
 
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public void toggleMenu(View v){
		this.root.toggleMenu();
	}
	
	
  

}
